package com.hrm.houfei.jsonfactory.moneypayment;

import java.util.List;

import com.hrm.houfei.jsontools.JSONArray;
import com.hrm.houfei.jsontools.JSONObject;
import com.hrm.houfei.po.Moneypaymentadd;

public class ConverListToPageJson {

	public ConverListToPageJson() {
		super();
	}

	/**
	 * 将List<Moneypaymentadd>转换成分页json数据
	 * 
	 * @param list
	 *            集合
	 * @param countList
	 *            总记录的条数(包括条件)
	 * @return json数据
	 */
	public static String converToPageJson(List<Moneypaymentadd> list, int countList) {
		JSONArray jsonArray = new JSONArray();
		JSONObject jsonObject = null;
		for (Moneypaymentadd mpa : list) {
			jsonObject = new JSONObject(mpa);
			jsonArray.put(jsonObject);
		}
		String json = jsonArray.toString();
		String jsonString = "{\"totalCount\":" + countList + ",\"rows\":"
				+ json + "}";
		return jsonString;
	}

}
